﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Logic.ClarizenSvc;

namespace Logic.ClarizenObjects
{
    public class Document: BaseObject
    {
        public String Name { get; set; }
        public String Description { get; set; }
        public GenericEntity DocumentType { get; set; }

        [Clarizen]
        public String DocumentTypeID
        {
            set { this.DocumentType = new GenericEntity { Id = new EntityId { TypeName = "DocumentType", Value = value } }; }
            get { return this.DocumentType != null && this.DocumentType.Id != null ? this.DocumentType.Id.Value : null; }
        }

        [Clarizen]
        public String Url { get; set; }

        [Clarizen]
        public String Path { get; set; }

        [Clarizen]
        public String Type { get; set; }

        [Clarizen(Editable=false, Selectable=true)]
        public DateTime LastUpdatedOn { get; set; }
        [Clarizen(Editable = false, Selectable = true)]
        public DateTime? CreatedOn { get; set; }

        [Clarizen(Editable = false, Selectable = true)]
        public GenericEntity CreatedBy { get; set; }
        [Clarizen(Editable = false, Selectable = true)]
        public String CreatedBy_Name { get { return CreatedBy == null ? null : CreatedBy.GetFieldValue("Name"); }}
        [Clarizen]
        public String CreatedOnString { get { return CreatedOn.HasValue? CreatedOn.Value.ToString("MM/dd/yy"): ""; } }

        [Clarizen]
        public String TaskID { get; set; }

        [Clarizen]
        public String LinkID { get; set; }
    }
}
